package com.selenium.core.functionlibrary;

import org.testng.Reporter;

import com.thoughtworks.selenium.SeleneseTestBase;

/**
 * Adds message to verify.* methods
 * This message would be available in test report if verification fails
 * <code>checkForVerificationErrors</code> <b>SHOULD</b> be called on the object
 * of <code>CustomVerification</code> class, else test method would not be marked 
 * as fail even in the wake of verification errors
 * 
 * @author tbhadauria
 *
 */
public class CustomVerification extends SeleneseTestBase {
	

	public void verifyTrue(String msg, Boolean b) {

		try{
			assertTrue (b);
		} catch (Error e) {				
			verificationErrors.append(e);
			Reporter.log(msg);
		}
	}
	
	public void verifyEquals(String s1, String s2) {
		try {
			assertEquals(s1, s2);

		} catch (Error e) {
			verificationErrors.append(e);			
		}
	}

	public void verifyEquals(String msg, String s1, String s2) {
		try {
			assertEquals(s1, s2);

		} catch (Error e) {
			verificationErrors.append(e);
			Reporter.log(msg);
		}
	}

	public void verifyEquals(String msg, Object obj1, Object obj2) {
		try {
			assertEquals(obj1, obj2);

		} catch (Error e) {
			verificationErrors.append(e);
			Reporter.log(msg);
		}
	}
	
	public void verifyEquals(String msg, String[]str1, String[] str2) {
		try {
			assertEquals(str1, str2);
		} catch (Error e) {
			verificationErrors.append(e);
			Reporter.log(msg);
		}
	}
	
	public void verifyEquals(String msg, Object[]str1, Object[] str2) {
		try {
			assertEquals(str1, str2);
		} catch (Error e) {
			verificationErrors.append(e);
			Reporter.log(msg);
		}
	}
}
